package com.inzone.fram.gray.config;

import com.inzone.fram.gray.common.filter.InitMatchingContextFilter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;
import javax.servlet.http.HttpServletRequest;

/**
 * 自动配置提供灰度算法
 *
 * @author 丁常磊
 * @date 2021/10/15 18:47
 */

@Configuration
@ConditionalOnClass({
        Filter.class,
        HttpServletRequest.class
})
public class MatchingHttpFilterConfig {

    /**
     * 初始化匹配上下文的拦截器
     * @return
     */
    @Bean
    public InitMatchingContextFilter initMatchingContextFilter() {
        return new InitMatchingContextFilter();
    }

}
